package com.lengxf.job.dynamicTask.finder;

import cn.hutool.json.JSONUtil;
import com.lengxf.job.dynamicTask.DynamicTask;
import com.lengxf.job.dynamicTask.Task;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class LogTaskDynamicTask implements DynamicTask {

    @Override
    public void executeTask(Task task) {
        if (!taskType().equals(task.getType())) {
            log.error("未找到对应类型[{}]的任务,请进行配置", task.getType());
        } else {
            log.info("执行了打印日志的定时任务,配置的任务为:{}", JSONUtil.toJsonStr(task));
        }
    }

    @Override
    public TaskTypeEnum taskType() {
        return TaskTypeEnum.LOG_TASK;
    }

}
